sub checkplace{
	foreach $o1 (keys %location){
		foreach $o2 (keys %location){
			foreach $o3 (keys %location){
				if($o1!=$o2&&$o2!=$o3&&$o1!=$o3&&$location{$o1}!=$location{$o2}&&$location{$o2}!=$location{$o3}&&$$location{$o1}!=$location{$o3}&&abs($location{$o1}-$location{$o2})==abs($location{$o2}-$location{$o3})){
					return(TRUE); 
				}
			}
		}
	}
}
sub place_orange{
my %owned;
my $orange;
	while($orange<9){
		$place=int(rand(41));
		while($owned{$place}<1){
					$orange++;
					$owned{$place}++;
					$location{$orange}=$place;
		}
	}
	
}
while($exp<1000){undef %location;place_orange();$exp++;$call=0;while(checkplace()){place_orange();$call++;}print "$exp\t$call\n"}
foreach(keys %location){print "$location{$_}\t";}print "\n";

